]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ibusCandidatePopup: Clarify assignment in condition
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 29 Jan 2019 21:56:03 +0000 (22:56 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 30 Jan 2019 16:13:16 +0000 (16:13 +0000)
Most often it is a bug if the condition part of a for-loop contains the
assignment operator rather than the comparison one, so tools rightfully
emit a warning.

Clarify that the assignment is intentional in this case by adding
parentheses.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375

js/ui/ibusCandidatePopup.js

index 1244268876ccfbd3d042d01bebbed4d60872220c..5bea998249fadb95d9e4577144e25c4cf26a2236 100644 (file)
@@ -236,7 +236,7 @@ var CandidatePopup = class CandidatePopup {
 
             let indexes = [];
             let indexLabel;
-            for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
+            for (let i = 0; (indexLabel = lookupTable.get_label(i)); ++i)
                  indexes.push(indexLabel.get_text());
 
             Main.keyboard.resetSuggestions();
@@ -295,7 +295,7 @@ var CandidatePopup = class CandidatePopup {
 
     _setTextAttributes(clutterText, ibusAttrList) {
         let attr;
-        for (let i = 0; attr = ibusAttrList.get(i); ++i)
+        for (let i = 0; (attr = ibusAttrList.get(i)); ++i)
             if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
                 clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
     }